package com.syh.core.ddd.domain;

import com.syh.core.ddd.event.DomainEventBus;
import com.syh.jn.scm.infrastructure.eventBus.reflex.ReflexEventBus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

/**
 * 抽象领域聚合，正常里面会有事件重写
 *
 * @param <ID>
 */
public abstract class AbstractAggregate<ID extends Serializable> extends AbstractEntity<ID> implements Aggregate<ID> {

	/**
	 * 不序列化
	 */
  protected transient Logger  logger = LoggerFactory.getLogger(this.getClass());

  /**
   * 发布事件
   *
   * @param event
   */
  @Override
  public void publicEvent(DomainEvent event) {
		DomainEventBus bus = ReflexEventBus.getEventBus();
    bus.publicEvent(event);
  }
}
